<template>
    <div id="temp">
        <div class="stuInfo">
            <div class="tit">
                <span>培训计划</span>
            </div>
            <el-row>
                <el-col :span="8">
                    <div>
                        <el-col :span="10">
                            <span class="left">课程编号：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.code}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">开课日期：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.startdate}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">教室：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.classroom}}</span>
                        </el-col>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div>
                        <el-col :span="10">
                            <span class="left">课程名称：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.name}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">结课日期：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.enddate}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">团购价：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.tgprice}}</span>
                        </el-col>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div>
                        <el-col :span="10">
                            <span class="left">状态：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.state}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">主讲培训师：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.trainer_name}}</span>
                        </el-col>
                    </div>
                    <div>
                        <el-col :span="10">
                            <span class="left">最小团购人数：</span>
                        </el-col>
                        <el-col :span="14">
                            <span class="right">{{trainDetail.tgnum}}</span>
                        </el-col>
                    </div>
                </el-col>
            </el-row>
        </div>
        <div class="record">
            <el-tabs type="border-card" v-model="activeName1" @tab-click="formChange">
                <el-tab-pane label="学员名单" name="Trainee">
                    <table class="tab-table">
                        <thead>
                        <tr class="trHead">
                            <th style="text-align:left" colspan="6" class="th-first">
                                <div class="head">
                                    <span>只看外籍学员：</span>
                                    <el-radio-group v-model="radio" @change="fillCountry">
                                        <el-radio :label="1">是</el-radio>
                                        <el-radio :label="2">否</el-radio>
                                    </el-radio-group>
                                    <el-button type="primary" size="small" @click="upload">导入名单</el-button>
                                    <el-button type="primary" size="small" @click="download">导出名单</el-button>
                                </div>

                            </th>
                            <th>
                                <el-button type="primary" size="small" :disabled="(!list.length) || disabled1"
                                           @click="btnClick('Trainee',1)">全部确认
                                </el-button>
                            </th>
                            <th>
                                <el-button type="primary" size="small" :disabled="(!list.length) || disabled2"
                                           @click="btnClick('Trainee',2)">全部参加
                                </el-button>
                            </th>
                            <th>
                                <el-button type="primary" size="small" :disabled="(!list.length) || disabled3"
                                           @click="btnClick('Trainee',3)">全部完成
                                </el-button>
                            </th>
                        </tr>
                        <tr>
                            <th>
                                <span class="icon add" @click="getInfo('student')"></span>
                            </th>
                            <th>序号</th>
                            <th width="120">身份证号/SIB</th>
                            <th>姓名</th>
                            <th>职务</th>
                            <th>缴费备注</th>
                            <th>确认</th>
                            <th>参加</th>
                            <th>完成</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in studentList" :key="index">
                            <td>
                                <span class="icon del" @click="del('Trainee',item.id)"></span>
                            </td>
                            <td>{{index+1}}</td>
                            <td style="color: #009eff;cursor:pointer;" @click="traineeDetail(item.traineeid)">
                                {{item.idcard?item.idcard:item.sib}}
                            </td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.zhiwu}}</td>
                            <td>{{item.tuition_note}}</td>
                            <td>
                                <el-button type="primary" size="small" :disabled="!!item.isconfirm"
                                           @click="btnClick('Trainee',1,item.id)">&nbsp;&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;&nbsp;
                                </el-button>
                            </td>
                            <td>
                                <el-button type="primary" size="small" :disabled="!!item.isparticipate"
                                           @click="btnClick('Trainee',2,item.id)">&nbsp;&nbsp;&nbsp;&nbsp;参加&nbsp;&nbsp;&nbsp;&nbsp;
                                </el-button>
                            </td>
                            <td>
                                <el-button type="primary" size="small" :disabled="!!item.isfinish"
                                           @click="btnClick('Trainee',3,item.id)">&nbsp;&nbsp;&nbsp;&nbsp;完成&nbsp;&nbsp;&nbsp;&nbsp;
                                </el-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <el-dialog title="添加学员名单" :visible.sync="studentPop" size="tiny">
                        <el-input icon="search" v-model="search" :on-icon-click="traineeSearch" placeholder="搜索学员"
                                  style="margin-bottom: 10px;"></el-input>

                        <el-collapse accordion>

                            <el-collapse-item v-for="item in allStudent" :key="item.id">
                                <template slot="title">
                                    {{item.name||item.ename}}
                                    <el-checkbox @click.native="checkedBox($event)" @change="checkedTrainee(item.id)"
                                                 style="float:right;margin-right: 10px;"></el-checkbox>
                                </template>
                                <div>身份证号：{{item.idcard}}</div>
                                <div>SIB：{{item.sib}}</div>
                                <div>手机号：{{item.tel}}</div>
                                <div>职务：{{item.zhiwu}}</div>
                                <div>适任证书号码：{{item.certificate}}</div>
                                <div>船东：{{item.chuandong}}</div>
                                <div>代理公司：{{item.daili}}</div>
                            </el-collapse-item>
                        </el-collapse>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="studentPop = false">取 消</el-button>
                            <!-- <el-button type="primary" @click="add('student','Trainee')">确 定</el-button> -->
                            <el-button type="primary" @click="addTrainee">确 定</el-button>
                        </div>
                    </el-dialog>

                    <el-dialog title="导入学员名单" :visible.sync="importFormVisible" size="tiny">
                        <el-upload :action="action" :auto-upload="false" :on-success="uploadSuccess" ref="upload"
                                   :file-list="fileList" :data="{id:id}">
                            <el-button type="primary" @click="fileList = []">选取文件</el-button>
                        </el-upload>
                        <div style="margin-top: 10px;">
                            <p>上传文件格式：</p>
                            <img src="../../img/student.png" alt="">
                        </div>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="addFormVisible = false">取 消</el-button>
                            <el-button type="primary" @click="importStudentSubmit">确 定</el-button>
                        </div>
                    </el-dialog>
                </el-tab-pane>
                <el-tab-pane label="意向学员" name="Intent">
                    <table class="tab-table">
                        <thead>
                        <tr class="trHead">
                            <th colspan="5"></th>
                            <th>
                                <el-button type="primary" :disabled="!list.length" size="small"
                                           @click="btnClick('Intent',1)">全部确认
                                </el-button>
                            </th>
                        </tr>
                        <tr>
                            <th>序号</th>
                            <th>身份证号/SIB</th>
                            <th>姓名</th>
                            <th>联系电话</th>
                            <th>登记日期</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list">
                            <td>{{index+1}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.tel}}</td>
                            <td>{{item.date}}</td>
                            <td>
                                <el-button type="primary" size="small" @click="btnClick('Intent',1,item.id)">&nbsp;&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </el-tab-pane>
                <el-tab-pane label="出勤记录" name="Signin" class="signin-tab">
                    <div class="head">
						<span class="em">
  							时段：选择时段发起签到
  						</span>
                        <span>
  							考勤异常状态：如：请假、迟到，点击查看详情
  						</span>
                        <el-button type="primary" @click="downloadSignin">下载签到记录表</el-button>
                    </div>
                    <!-- <div class="table-wrapper">
                      <div class="left-table">
                        <table class="table signin-table head-table-left" :class="{fixed:isFixed}">
                          <thead>
                            <tr>
                              <th>日期</th>
                              <th>时段</th>
                            </tr>
                          </thead>
                          <tbody style="border-top: 1px solid #e2e2e2;">
                            <tr>
                              <td>出勤率</td>
                              <td></td>
                            </tr>

                          </tbody>
                        </table>
                        <table class="table signin-table" :class="{fixed:isFixed}">

                          <tbody style="border-top: 1px solid #e2e2e2;">

                            <tr v-for="item in list.date" :key="item.id" class="left-div">
                              <td>{{item.date}}</td>
                              <td @click="signin(item.id)" style="color:#009eff;cursor:pointer;">{{item.time==1?'上午':'下午'}}</td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div class="right-table" >
                        <table class="table signin-table head-table" :class="{fixed:isFixed}">
                          <thead>
                            <tr>
                              <th v-for="item in list.trainee" :key="item.traineeid">{{item.name||item.ename}}</th>
                            </tr>
                          </thead>
                          <tbody>
                            <tr>
                              <td v-for="item in list.rate" :key="item">{{item===''?'':item+'%'}}</td>
                            </tr>
                          </tbody>
                        </table>
                        <table class="table signin-table detail-table" >
                          <tbody>
                            <tr v-for="item in list.date" :key="item.id">
                              <td v-for="(item1,index) in item.state" :key="item1" @click="signinDetail(item.id,index,item1)" :class="{'text-warining':item1=='请假(待审核)'}">{{item1}}</td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </div> -->
                    <div class="table-wrapper" id="signin-table" @scroll="scroll">
                        <div>
                            <table class="table signin-table">
                                <thead>
                                <tr>
                                    <th>日期</th>
                                    <th>时段</th>
                                    <th v-for="(item,index) in list.trainee" :key="item.traineeid">
                                        {{item.name||item.ename}}
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>出勤率</td>
                                    <td></td>
                                    <td v-for="item in list.rate">{{item===''?'':item+'%'}}</td>
                                </tr>
                                <tr v-for="item in list.date" :key="item.id">
                                    <td>{{item.date}}</td>
                                    <td @click="signin(item.id)" style="color:#009eff;cursor:pointer;">
                                        {{item.time==1?'上午':'下午'}}
                                    </td>
                                    <td v-for="(item1,index) in item.state" :key="item1"
                                        @click="signinDetail(item.id,index,item1)"
                                        :class="{'text-warining':item1=='请假(待审核)'}">{{item1}}
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="common-table" v-show="showLeftTable||showTopTable" style="z-index: 1001;">
                            <table class="table signin-table">
                                <thead>
                                <tr>
                                    <th>日期</th>
                                    <th>时段</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>出勤率</td>
                                    <td></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div style="position: absolute;top: 50px; left: 0;overflow: hidden;width: 147px;height: 435px;"
                             v-show="showLeftTable">
                            <div style="position: relative;width: 147px;height: 435px;">
                                <div class="left-table" id="left-table">
                                    <table class="table signin-table">
                                        <tbody>
                                        <tr v-for="item in list.date" :key="item.id">
                                            <td>{{item.date}}</td>
                                            <td @click="signin(item.id)" style="color:#009eff;cursor:pointer;">
                                                {{item.time==1?'上午':'下午'}}
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="top-table" v-show="showTopTable" id="top-table">
                            <table class="table signin-table">
                                <thead>
                                <tr>
                                    <th v-for="(item,index) in list.trainee" :key="item.traineeid">
                                        {{item.name||item.ename}}
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td v-for="item in list.rate">{{item===''?'':item+'%'}}</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <el-dialog :visible.sync="LatePop" size="tiny">

                        <el-form :model="late" ref="late">
                            <el-form-item label="考勤状态" :label-width="width" prop="type">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="late.state">
                                        <el-option label="旷到" :value="0"></el-option>
                                        <el-option label="签到" :value="1"></el-option>
                                        <el-option label="迟到" :value="2"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <!-- <el-form-item label="到达时间" :label-width="width" prop="latetime" v-if="late.state == 2">
                                <el-col :span="20">
                                    <el-time-picker v-model="late.latetime" placeholder="请选择">
                                    </el-time-picker>
                                </el-col>
                            </el-form-item> -->
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="LatePop = false">取 消</el-button>
                            <el-button type="primary" @click="stateSubmit">确 定</el-button>
                        </div>
                    </el-dialog>
                    <el-dialog :visible.sync="leavePop" size="tiny">
                        <el-form :model="leave" ref="leave">
                            <el-form-item label="请假事由" :label-width="width" prop="reason">
                                <el-col :span="20">
                                    <el-input type="textarea" :rows="3" v-model="leave.reason" size="small"
                                              :disabled="true"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="审核意见" :label-width="width" prop="type">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="leave.state">
                                        <el-option label="批准" :value="1"></el-option>
                                        <el-option label="驳回" :value="-1"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="驳回理由" :label-width="width" prop="reject_reason"
                                          v-if="leave.state == -1">
                                <el-col :span="20">
                                    <el-input type="textarea" :rows="3" v-model="leave.reject_reason"
                                              size="small"></el-input>
                                </el-col>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="leavePop = false">取 消</el-button>
                            <el-button type="primary" @click="leaveSubmit">确 定</el-button>
                        </div>
                    </el-dialog>
                    <el-dialog :visible.sync="qrcode" size="tiny" style="text-align: center;" @close="signinEnd">
                        <canvas id="canvas"></canvas>

                    </el-dialog>
                </el-tab-pane>
                <el-tab-pane label="课前准备" name="Prepare">
                    <table class="tab-table">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>项目</th>
                            <th>确认</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>1</td>
                            <td>房间</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('fangjian')"
                                           :disabled="prepare.fangjian?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>2</td>
                            <td>设备</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('shebei')"
                                           :disabled="prepare.shebei?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>3</td>
                            <td>投影仪</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('touyingyi')"
                                           :disabled="prepare.touyingyi?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>4</td>
                            <td>计算机</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('jisuanji')"
                                           :disabled="prepare.jisuanji?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>5</td>
                            <td>视听</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('shiting')"
                                           :disabled="prepare.shiting?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>6</td>
                            <td>模拟器</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('moniqi')"
                                           :disabled="prepare.moniqi?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>7</td>
                            <td>资料</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('ziliao')"
                                           :disabled="prepare.ziliao?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>8</td>
                            <td>IMO参考资料</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('imo')"
                                           :disabled="prepare.imo?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>9</td>
                            <td>教材</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('jiaocai')"
                                           :disabled="prepare.jiaocai?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>10</td>
                            <td>参考书目</td>
                            <td>
                                <el-button type="primary" size="small" @click="confirm('shumu')"
                                           :disabled="prepare.shumu?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>11</td>
                            <td>耗材编号</td>
                            <td class="consumable">
                                <el-input v-model="input1" placeholder="请输入内容" size="small" style="max-width:150px"
                                          :disabled="prepare.haocai!==null?true:false"></el-input>
                                <el-button type="primary" size="small" @click="confirm('haocai')"
                                           :disabled="prepare.haocai!==null?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        <tr>
                            <td>12</td>
                            <td>耗材数量</td>
                            <td class="consumable">
                                <el-input v-model="input2" placeholder="请输入内容" size="small" style="max-width:150px"
                                          :disabled="prepare.haocainum!==null?true:false"></el-input>
                                <el-button type="primary" size="small" @click="confirm('haocainum')"
                                           :disabled="prepare.haocainum!==null?true:false">确认
                                </el-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </el-tab-pane>
                <el-tab-pane label="测评">
                    <el-tabs v-model="activeName2" @tab-click="formChange2">
                        <el-tab-pane label="课前测评" name='ago'>
                            <div class="head">
                                <span class="icon addb" @click="addTeacher('mark')"></span><span
                                    class="bottom">添加评卷老师</span><span class="teacher">评卷老师：{{teacher}}</span>
                                <el-dialog :visible.sync="markPop" title="添加评卷老师" size="tiny">
                                    <el-form :model="mark" ref="mark" :rules="markRules">
                                        <el-form-item label="教师姓名" :label-width="width" prop="name">
                                            <el-col :span="20">
                                                <el-select v-model="mark.name" placeholder="请选择" size="small"
                                                           filterable>
                                                    <el-option v-for="(item,index) in teacherList" :key="index"
                                                               :label="item.name" :value="item.id">
                                                    </el-option>
                                                </el-select>
                                            </el-col>
                                        </el-form-item>
                                        <el-form-item label="教师编号" :label-width="width">
                                            <el-col :span="20">
                                                <el-select v-model="mark.name" placeholder="请选择" size="small" disabled>
                                                    <el-option v-for="(item,index) in teacherList" :key="index"
                                                               :label="item.number" :value="item.id">
                                                    </el-option>
                                                </el-select>
                                            </el-col>
                                        </el-form-item>
                                    </el-form>
                                    <div slot="footer" class="dialog-footer">
                                        <el-button @click="markPop = false">取 消</el-button>
                                        <el-button type="primary" @click="subAddTeacher('mark')">确 定</el-button>
                                    </div>
                                </el-dialog>
                            </div>
                            <table class="tab-table">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>姓名</th>
                                    <th>身份证号/SIB</th>
                                    <th>评卷人</th>
                                    <th>得分</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr v-for="(item,index) in RaisalList">
                                    <td>{{index + 1}}</td>
                                    <td>{{item.name||item.ename}}</td>
                                    <td>{{item.idcard||item.sib}}</td>
                                    <td>{{item.teacher}}</td>
                                    <td v-if="item.state !== false" @click="getRaisalDetail(item.qid,'scoreAog')"
                                        style="cursor: pointer;" :class="{red: item.state === 0}">{{item.score}}
                                    </td>
                                    <td v-else-if="item.state === false">未测评</td>
                                    <td style="color:red;cursor:pointer" v-if="item.state !== false"
                                        @click="delAppraisal(item.qid)">删除
                                    </td>
                                    <td v-else></td>
                                </tr>
                                </tbody>
                            </table>
                            <!-- 得分情况 -->
                            <div class="scoreDetail">
                                <el-dialog title="" :visible.sync="scoreAogPop">
                                    <div>
                                        <h4>课前测评</h4>
                                        <el-row>
                                            <el-col :span="8">
                                                <div>学员：{{info.name||info.ename}}</div>
                                            </el-col>
                                            <el-col :span="8">
                                                <div>评卷教师：{{info.teacher}}</div>
                                            </el-col>
                                            <el-col :span="8">
                                                <div>得分：{{info.score}}</div>
                                            </el-col>
                                        </el-row>
                                        <div class="questions questions-dialog">
                                            <div v-for="(item,index) in RaisalDetail">
                                                <p><span>{{index + 1}}.</span><span v-html="item.question"></span> <span
                                                        v-if="item.type == 3">（满分：{{item.score}}分）</span></p>
                                                <div class="" v-if="item.type === '1'">
                                                    <el-radio-group v-model="item.his_answer" disabled>
                                                        <div>
                                                            <el-radio label="A">A. <span v-html="item.a"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="B">B. <span v-html="item.b"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="C">C. <span v-html="item.c"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="D">D. <span v-html="item.d"></span>
                                                            </el-radio>
                                                        </div>
                                                    </el-radio-group>
                                                </div>
                                                <div class="" v-if="item.type === '2'">
                                                    <el-radio-group v-model="item.his_answer" disabled>
                                                        <div class="">
                                                            <el-radio label="T">对</el-radio>
                                                            <el-radio label="F">错</el-radio>
                                                        </div>
                                                    </el-radio-group>
                                                </div>
                                                <div class="" v-if="item.type === '3'">
                                                    <div class="info">
                                                        <el-input type="textarea" :value="item.his_answer"
                                                                  disabled></el-input>
                                                    </div>
                                                </div>
                                                <div class="answer" v-if="item.type == 1">
                                                    <span>正确答案：{{item.answer}}</span>
                                                    <span>得分：{{item.his_score}}</span>
                                                </div>
                                                <div class="answer" v-if="item.type == 2">
                                                    <span>正确答案：{{item.answer=='T'?'对':'错'}}</span>
                                                    <span>得分：{{item.his_score}}</span>
                                                </div>
                                                <div class="answer" v-if="item.type == 3">
                                                    <span>正确答案：{{item.answer}}</span>
                                                    <span>得分：<input type="text" v-model="item.his_score"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <span slot="footer" class="dialog-footer" v-if="info.state === 0">
										                  <el-button type="primary"
                                                                     @click="scoreSubmit('scoreAog',info.id)">提交</el-button></span>
                                </el-dialog>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="课后测评" name="later">
                            <div class="head">
                                <span class="icon addb" @click="addTeacher('back')"></span><span
                                    class="bottom">添加评卷老师</span><span class="teacher">评卷老师：{{teacher}}</span>
                                <el-dialog :visible.sync="backPop" title="添加测评老师">
                                    <el-form :model="back" ref="back" :rules="backRules">
                                        <el-form-item label="教师姓名" :label-width="width" prop="name">
                                            <el-col :span="20">
                                                <el-select v-model="back.name" placeholder="请选择" size="small">
                                                    <el-option v-for="(item,index) in teacherList" :key="index"
                                                               :label="item.name" :value="item.id">
                                                    </el-option>
                                                </el-select>
                                            </el-col>
                                        </el-form-item>
                                        <el-form-item label="教师编号" :label-width="width">
                                            <el-col :span="20">
                                                <el-select v-model="back.name" placeholder="请选择" size="small" disabled>
                                                    <el-option v-for="(item,index) in teacherList" :key="index"
                                                               :label="item.number" :value="item.id">
                                                    </el-option>
                                                </el-select>
                                            </el-col>
                                        </el-form-item>
                                    </el-form>
                                    <div slot="footer" class="dialog-footer">
                                        <el-button @click="backPop = false">取 消</el-button>
                                        <el-button type="primary" @click="subAddTeacher('back')">确 定</el-button>
                                    </div>
                                </el-dialog>
                            </div>
                            <table class="tab-table">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>姓名</th>
                                    <th>身份证号/SIB</th>
                                    <th>评卷人</th>
                                    <th>得分</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr v-for="(item,index) in RaisalList">
                                    <td>{{index + 1}}</td>
                                    <td>{{item.name||item.ename}}</td>
                                    <td>{{item.idcard||item.sib}}</td>
                                    <td>{{item.teacher}}</td>
                                    <td v-if="item.state !== false" @click="getRaisalDetail(item.qid,'scoreBack')"
                                        style="cursor: pointer;" :class="{red: item.state === 0}">
                                        {{item.score}}
                                    </td>
                                    <td v-else-if="item.state === false">未测评</td>
                                    <td style="color:red;cursor:pointer" v-if="item.state !== false"
                                        @click="delAppraisal(item.qid)">删除
                                    </td>
                                    <td v-else></td>
                                </tr>
                                </tbody>
                            </table>
                            <!-- 得分情况 -->
                            <div class="scoreDetail">
                                <el-dialog title="" :visible.sync="scoreBackPop" size="tiny">
                                    <div>
                                        <h4>课后测评</h4>
                                        <el-row>
                                            <el-col :span="8">
                                                <div>学员：{{info.name||info.ename}}</div>
                                            </el-col>
                                            <el-col :span="8">
                                                <div>评卷教师：{{info.teacher}}</div>
                                            </el-col>
                                            <el-col :span="8">
                                                <div>得分：{{info.score}}</div>
                                            </el-col>
                                        </el-row>
                                        <div class="questions questions-dialog">
                                            <div v-for="(item,index) in RaisalDetail">
                                                <p>{{index + 1}}. <span v-html="item.question"></span><span
                                                        v-if="item.type == 3">（满分：{{item.score}}分）</span></p>
                                                <div class="" v-if="item.type === '1'">
                                                    <el-radio-group v-model="item.his_answer" disabled>
                                                        <div>
                                                            <el-radio label="A">A. <span v-html="item.a"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="B">B. <span v-html="item.b"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="C">C. <span v-html="item.c"></span>
                                                            </el-radio>
                                                        </div>
                                                        <div>
                                                            <el-radio label="D">D. <span v-html="item.d"></span>
                                                            </el-radio>
                                                        </div>
                                                    </el-radio-group>
                                                </div>
                                                <div class="" v-if="item.type === '2'">
                                                    <el-radio-group v-model="item.his_answer" disabled>
                                                        <div class="">
                                                            <el-radio label="T">对</el-radio>
                                                            <el-radio label="F">错</el-radio>
                                                        </div>
                                                    </el-radio-group>
                                                </div>
                                                <div class="" v-if="item.type === '3'">
                                                    <div class="info">
                                                        <el-input type="textarea" :value="item.his_answer"
                                                                  disabled></el-input>
                                                    </div>
                                                </div>
                                                <div class="answer" v-if="item.type == 1">
                                                    <span>正确答案：{{item.answer}}</span>
                                                    <span>得分：{{item.his_score}}</span>
                                                </div>
                                                <div class="answer" v-if="item.type == 2">
                                                    <span>正确答案：{{item.answer=='T'?'对':'错'}}</span>
                                                    <span>得分：{{item.his_score}}</span>
                                                </div>
                                                <div class="answer" v-if="item.type == 3">
                                                    <span>正确答案：{{item.answer}}</span><br>
                                                    <span>得分：<input type="text" v-model="item.his_score"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <span slot="footer" class="dialog-footer" v-if="info.state === 0">
										                  <el-button type="primary"
                                                                     @click="scoreSubmit('scoreBack',info.id)">提交</el-button></span>
                                </el-dialog>
                            </div>
                        </el-tab-pane>
                    </el-tabs>
                </el-tab-pane>
                <el-tab-pane label="证书" name="Certificate">
                    <table class="tab-table">
                        <thead>
                        <tr class="trHead">
                            <th colspan="7"></th>
                            <th>
                                <el-button type="primary" :disabled="disabled4" size="small"
                                           @click="certificateGrant(1)">全部是
                                </el-button>
                            </th>
                            <th></th>
                            <th>
                                <el-button type="primary" size="small" @click="certificateGrant(2)">全部打印</el-button>
                            </th>
                        </tr>
                        <tr>
                            <th>序号</th>
                            <th>姓名</th>
                            <th>身份证号/SIB</th>
                            <th>证书编号</th>
                            <th>打印次数</th>
                            <th>最近一次打印日期</th>
                            <th>打印人</th>
                            <th>是否发放</th>
                            <th>发放时间</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list">
                            <td>{{index+1}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.certificate}}</td>
                            <td>{{item.certificate_times}}</td>
                            <td>{{item.certificate_date}}</td>
                            <td>{{item.certificate_person}}</td>
                            <td>
                                <el-button type="primary" :disabled="!!item.certificate_provide" size="small"
                                           @click="certificateGrant(1,item.id)">&nbsp;&nbsp;&nbsp;是&nbsp;&nbsp;&nbsp;
                                </el-button>
                            </td>
                            <td>{{item.certificate_providedate}}</td>
                            <td>
                                <el-button type="primary" size="small" @click="certificateGrant(2,item.id)">&nbsp;&nbsp;&nbsp;打印&nbsp;&nbsp;&nbsp;</el-button>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                </el-tab-pane>
                <el-tab-pane label="缴费" name="Pay">
                    <!--<el-select style="margin-top: 10px;margin-bottom: 10px;" v-model="apply_id" placeholder="报名单位"-->
                               <!--filterable clearable @change="getList('Pay')">-->
                        <!--<el-option label="个人" value="0"></el-option>-->
                        <!--<el-option v-for="item in applylist" :key="item.id" :label="item.name"-->
                                   <!--:value="item.id"></el-option>-->
                    <!--</el-select>-->
                    <table class="tab-table">
                        <thead>
                        <tr>
                            <th>
                                <img src="../../img/excel.gif" alt="" @click="downloadPay">
                            </th>
                            <th width="50">序号</th>
                            <th width="60">姓名</th>
                            <th>身份证号/SIB</th>
                            <th width="60">职务</th>
                            <th>联系电话</th>
                            <th>船东</th>
                            <th>代理公司</th>
                            <th>报名单位</th>
                            <th>付费方</th>
                            <th>学费</th>
                            <th>已缴费用</th>
                            <th>积分兑换</th>
                            <!-- <th>发放时间</th> -->
                            <th>INV no.</th>
                            <th>备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list" :key="index">
                            <td>
                                <span class="icon deit" @click="getInfo('deit','Pay',item.id,item.tid)"></span>
                            </td>
                            <td>{{index+1}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.zhiwu}}</td>
                            <td>{{item.tel}}</td>
                            <td>{{item.chuandong}}</td>
                            <td>{{item.daili}}</td>
                            <td>{{item.apply_name}}</td>
                            <td>{{item.payer_name}}</td>
                            <td>{{item.tuition||0}}</td>
                            <td>{{item.paid||0}}</td>
                            <td>{{item.integral||0}}</td>
                            <td>{{item.inv}}</td>
                            <td>{{item.tuition_note}}</td>
                        </tr>
                        <tr>
                            <td colspan="3">合计</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>{{tuition_total}}</td>
                            <td>{{paid_total}}</td>
                            <td>{{integral_total}}</td>
                            <td></td>
                            <td></td>
                        </tr>
                        </tbody>
                    </table>
                    <el-dialog :visible.sync="deitPop" size="tiny">
                        <el-form :model="deitForm" ref="deit">
                            <el-form-item label="报名单位" :label-width="width" prop="payer">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="deitForm.apply" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option label="个人" :value="0"></el-option>
                                        <el-option v-for="(item,index) in payList" :key="index" :label="item.name"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="付费方" :label-width="width" prop="payer">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="deitForm.payer" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option label="个人" :value="0"></el-option>
                                        <el-option v-for="(item,index) in payList" :key="index" :label="item.name"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="船东" :label-width="width">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="deitForm.chuandong" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option v-for="(item,index) in payList" :key="index" :label="item.name"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="代理公司" :label-width="width" >
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="deitForm.daili" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option v-for="(item,index) in payList" :key="index" :label="item.name"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="职务" :label-width="width">
                                <el-col :span="20">
                                    <el-select v-model="deitForm.zhiwu"  filterable clearable>
                                        <el-option v-for="item in zhiwuList" :key="item.id" :label="item.name" :value="item.name"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="学费" :label-width="width" prop="tuition">
                                <el-col :span="20">
                                    <el-input v-model="deitForm.tuition" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="已缴学费" :label-width="width" prop="paid">
                                <el-col :span="20">
                                    <el-input v-model="deitForm.paid" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="INV no." :label-width="width" prop="inv">
                                <el-col :span="20">
                                    <el-input v-model="deitForm.inv" size="small" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="备注" :label-width="width" prop="tuition_note">
                                <el-col :span="20">
                                    <el-input type="textarea" :rows="3" v-model="deitForm.tuition_note" size="small"
                                              auto-complete="off" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="deitPop = false">取 消</el-button>
                            <el-button type="primary" @click="add('deit','Pay')">确 定</el-button>
                        </div>
                    </el-dialog>
                </el-tab-pane>
                <el-tab-pane label="订票" name="Ticket">
                    <table class="tab-table">
                        <thead>
                        <tr>
                            <th><span class="icon add" @click="getInfo('booking')"></span></th>
                            <th>序号</th>
                            <th>姓名</th>
                            <th>身份证号/SIB</th>
                            <th>联系电话</th>
                            <th>日期</th>
                            <th>航班</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list">
                            <td>
                                <span class="icon deit" @click="getInfo('booking','Ticket',item.id)"></span>
                                <span class="icon del" @click="del('Ticket',item.id)"></span>
                            </td>
                            <td>{{index+1}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.tel}}</td>
                            <td>{{item.date}}</td>
                            <td>{{item.flight}}</td>
                        </tr>
                        </tbody>
                    </table>
                    <el-dialog :visible.sync="bookingPop" size="tiny">
                        <el-form :model="bookingForm" ref="booking" :rules="bookingRules">
                            <el-form-item label="姓名" :label-width="width" prop="traineeid">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="bookingForm.traineeid" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option v-for="(item,index) in trainingStudent" :key="index"
                                                   :label="item.name?item.name:item.ename" :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <!-- <el-form-item label="身份证号/SIB" :label-width="width" prop="idcard">
                                <el-col :span="20">
                                    <el-input disabled v-model="bookingForm.idcard" size="small" auto-complete="off" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item> -->
                            <el-form-item label="日期" :label-width="width" prop="date">
                                <el-col :span="20">
                                    <el-date-picker style="width:100%" v-model="bookingForm.date" type="date"
                                                    size="small" placeholder="请选择" auto-complete="off">
                                    </el-date-picker>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="航班" :label-width="width" prop="flight">
                                <el-col :span="20">
                                    <el-input v-model="bookingForm.flight" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="bookingPop = false">取 消</el-button>
                            <el-button type="primary" @click="add('booking','Ticket')">确 定</el-button>
                        </div>
                    </el-dialog>
                </el-tab-pane>
                <el-tab-pane label="交通安排" name="Traffic">
                    <table class="tab-table">
                        <thead>
                        <tr>
                            <th><span class="icon add" @click="getInfo('traffic')"></span></th>
                            <th>序号</th>
                            <th>姓名</th>
                            <th>身份证号/SIB</th>
                            <th>联系电话</th>
                            <th>日期</th>
                            <th>航班</th>
                            <th>车次</th>
                            <th>交通安排</th>
                            <th>确认</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list">
                            <td>
                                <span class="icon deit" @click="getInfo('traffic','Traffic',item.id)"></span>
                                <span class="icon del" @click="del('Traffic',item.id)"></span>
                            </td>
                            <td>{{index+1}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.tel}}</td>
                            <td>{{item.date}}</td>
                            <td>{{item.flight}}</td>
                            <td>{{item.train}}</td>
                            <td>{{item.traffic}}</td>
                            <td>
                                <el-button type="primary" size="small" v-if="!item.confirm"
                                           @click="btnClick('Traffic',1,item.id)">&nbsp;&nbsp;&nbsp;&nbsp;是&nbsp;&nbsp;&nbsp;&nbsp;
                                </el-button>
                                <span v-else>{{item.confirm}}</span>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <el-dialog :visible.sync="trafficPop" size="tiny">
                        <el-form :model="trafficForm" ref="traffic" :rules="trafficRules">
                            <el-form-item label="姓名" :label-width="width" prop="traineeid">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="trafficForm.traineeid" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option v-for="(item,index) in trainingStudent" :key="index"
                                                   :label="item.name?item.name:item.ename" :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <!-- <el-form-item label="身份证号/SIB" :label-width="width" prop="idcard">
                                <el-col :span="20">
                                    <el-input disabled v-model="trafficForm.idcard" size="small" auto-complete="off" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item> -->
                            <el-form-item label="日期" :label-width="width" prop="date">
                                <el-col :span="20">
                                    <el-date-picker style="width:100%" v-model="trafficForm.date" type="date"
                                                    size="small" placeholder="请选择" auto-complete="off">
                                    </el-date-picker>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="航班" :label-width="width" prop="flight">
                                <el-col :span="20">
                                    <el-input v-model="trafficForm.flight" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="车次" :label-width="width" prop="train">
                                <el-col :span="20">
                                    <el-input v-model="trafficForm.train" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="交通安排" :label-width="width" prop="traffic">
                                <el-col :span="20">
                                    <el-input v-model="trafficForm.traffic" size="small" auto-complete="off"
                                              placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="trafficPop = false">取 消</el-button>
                            <el-button type="primary" @click="add('traffic','Traffic')">确 定</el-button>
                        </div>
                    </el-dialog>
                </el-tab-pane>
                <el-tab-pane label="酒店和伙补" name="Hotel">
                    <el-tabs v-model="activeName" @tab-click="formChange">
                        <el-tab-pane label="酒店安排" name="Hotel">
                            <table class="tab-table">
                                <thead>
                                <tr>
                                    <th>
                                        <img src="../../img/excel.gif" alt="" @click="downloadHotel">
                                    </th>
                                    <th>序号</th>
                                    <th>姓名</th>
                                    <th>身份证号/SIB</th>
                                    <th>联系电话</th>
                                    <th>酒店名称</th>
                                    <th>酒店标准</th>
                                    <th>入住日期</th>
                                    <th>离店日期</th>
                                    <th>入住天数</th>
                                    <th>住宿总费用</th>
                                    <th>已收费用</th>
                                    <th>付费方</th>
                                    <th>已付费用</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr v-for="(item,index) in list">
                                    <td>
                                        <span class="icon deit"
                                              @click="getInfo('hotel','Hotel',item.id,item.tid)"></span>
                                    </td>
                                    <td>{{index+1}}</td>
                                    <td>{{item.name?item.name:item.ename}}</td>
                                    <td>{{item.idcard?item.idcard:item.sib}}</td>
                                    <td>{{item.tel}}</td>
                                    <td>{{item.hotel_name}}</td>
                                    <td>{{item.hotel}}</td>
                                    <td>{{item.startdate}}</td>
                                    <td>{{item.enddate}}</td>
                                    <td>{{item.days}}</td>
                                    <td>{{item.hotel_money}}</td>
                                    <td>{{item.paid_money}}</td>
                                    <td>{{item.payer}}</td>
                                    <td>{{item.give_money}}</td>
                                </tr>
                                <tr>
                                    <td colspan="2">合计</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td>{{hotel_money_total}}</td>
                                    <td>{{hotel_paid_money_total}}</td>
                                    <td></td>
                                    <td>{{hotel_give_money_total}}</td>
                                </tr>
                                </tbody>
                            </table>
                            <el-dialog :visible.sync="hotelPop" size="tiny">
                                <el-form :model="hotelForm" ref="hotel">

                                    <el-form-item label="酒店标准" :label-width="width" prop="hotel">
                                        <el-col :span="20">
                                            <el-input v-model="hotelForm.hotel" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="酒店名称" :label-width="width" prop="hotelid">
                                        <el-col :span="20">
                                            <el-select style="width:100%" v-model="hotelForm.hotelid" placeholder="请选择"
                                                       size="small" filterable>
                                                <el-option v-for="(item,index) in hotelList" :key="index"
                                                           :label="item.name" :value="item.id"></el-option>
                                            </el-select>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="入住日期" :label-width="width" prop="startdate">
                                        <el-col :span="20">
                                            <el-date-picker style="width:100%" v-model="hotelForm.startdate" type="date"
                                                            size="small" placeholder="请选择">
                                            </el-date-picker>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="离店日期" :label-width="width" prop="enddate">
                                        <el-col :span="20">
                                            <el-date-picker style="width:100%" v-model="hotelForm.enddate" type="date"
                                                            size="small"
                                                            placeholder="请选择">
                                            </el-date-picker>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="入住天数" :label-width="width" prop="days">
                                        <el-col :span="20">
                                            <el-input v-model="hotelForm.days" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="住宿总费用" :label-width="width" prop="hotel_money">
                                        <el-col :span="20">
                                            <el-input v-model="hotelForm.hotel_money" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="已收费用（付费方）" :label-width="width" prop="paid_money">
                                        <el-col :span="20">
                                            <el-input v-model="hotelForm.paid_money" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>

                                    <el-form-item label="付费方" :label-width="width" prop="hotel_payer">
                                        <el-col :span="20">
                                            <el-select style="width:100%" v-model="hotelForm.hotel_payer"
                                                       placeholder="请选择" size="small" filterable>
                                                <el-option label="个人" :value="0"></el-option>
                                                <el-option v-for="(item,index) in payList" :key="index"
                                                           :label="item.name" :value="item.id"></el-option>
                                            </el-select>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="已付费用（酒店）" :label-width="width" prop="give_money">
                                        <el-col :span="20">
                                            <el-input v-model="hotelForm.give_money" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                </el-form>
                                <div slot="footer" class="dialog-footer">
                                    <el-button @click="hotelPop = false">取 消</el-button>
                                    <el-button type="primary" @click="add('hotel','Hotel')">确 定</el-button>
                                </div>
                            </el-dialog>
                        </el-tab-pane>
                        <el-tab-pane label="伙补安排" name="Meal">
                            <table class="tab-table">
                                <thead>
                                <tr>
                                    <th>
                                        <img src="../../img/excel.gif" alt="" @click="downloadMeal">
                                    </th>
                                    <th>序号</th>
                                    <th>姓名</th>
                                    <th>身份证号</th>
                                    <th>联系电话</th>
                                    <th>伙补标准</th>
                                    <th>伙补总费用</th>
                                    <th>确认</th>
                                    <th>已缴费用</th>
                                    <th>付费方</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr v-for="(item,index) in list">
                                    <td>
                                        <span class="icon deit" @click="getInfo('food','Meal',item.id,item.tid)"></span>
                                    </td>
                                    <td>{{index+1}}</td>
                                    <td>{{item.name||item.ename}}</td>
                                    <td>{{item.idcard||item.sib}}</td>
                                    <td>{{item.tel}}</td>
                                    <td>{{item.meal}}</td>
                                    <td>{{item.meal_money}}</td>
                                    <td>
                                        <el-button v-if="!item.confirm" type="primary" size="small"
                                                   @click="btnClick('Meal',1,item.id)">确认
                                        </el-button>
                                        <span v-else>{{item.confirm}}</span>
                                    </td>
                                    <td>{{item.meal_paid_money}}</td>
                                    <td>{{item.payer}}</td>
                                </tr>
                                <tr>
                                    <td colspan="2">合计</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td>{{meal_money_total}}</td>
                                    <td></td>
                                    <td>{{meal_paid_money_total}}</td>
                                    <td></td>
                                </tr>
                                </tbody>
                            </table>
                            <el-dialog :visible.sync="foodPop" size="tiny">
                                <el-form :model="foodForm" ref="food">

                                    <el-form-item label="伙补标准" :label-width="width" prop="meal">
                                        <el-col :span="20">
                                            <el-input v-model="foodForm.meal" size="small" auto-complete="off"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="伙补总费用" :label-width="width" prop="meal_money">
                                        <el-col :span="20">
                                            <el-input v-model="foodForm.meal_money" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="已缴费用" :label-width="width" prop="meal_paid_money">
                                        <el-col :span="20">
                                            <el-input v-model="foodForm.meal_paid_money" size="small"
                                                      placeholder="请输入"></el-input>
                                        </el-col>
                                    </el-form-item>
                                    <el-form-item label="付费方" :label-width="width" prop="meal_payer">
                                        <el-col :span="20">
                                            <el-select style="width:100%" v-model="foodForm.meal_payer"
                                                       placeholder="请选择" size="small" filterable>
                                                <el-option label="个人" :value="0"></el-option>
                                                <el-option v-for="(item,index) in payList" :key="index"
                                                           :label="item.name" :value="item.id"></el-option>
                                            </el-select>
                                        </el-col>
                                    </el-form-item>
                                </el-form>
                                <div slot="footer" class="dialog-footer">
                                    <el-button @click="foodPop = false">取 消</el-button>
                                    <el-button type="primary" @click="add('food','Meal')">确 定</el-button>
                                </div>
                            </el-dialog>
                        </el-tab-pane>
                    </el-tabs>
                </el-tab-pane>
                <el-tab-pane label="课程反馈" name="Feedback">
                    <el-tabs v-model="activeName3" @tab-click="handleClick">
                        <el-tab-pane label="学员" name="1">
                            <div id="myChart1" style="width:600px;height:400px;margin:0 auto"></div>
                        </el-tab-pane>
                        <el-tab-pane label="客户" name="2">
                            <div id="myChart2" style="width:600px;height:400px;margin:0 auto"></div>
                        </el-tab-pane>
                    </el-tabs>
                </el-tab-pane>
                <el-tab-pane label="备注" name="Note">
                    <table class="tab-table">
                        <thead>
                        <tr>
                            <th><span class="icon add" @click="getInfo('remark')"></span></th>
                            <th>序号</th>
                            <th>姓名</th>
                            <th>身份证号/SIB</th>
                            <th>备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in list">
                            <td>
                                <span class="icon deit" @click="getInfo('remark','Note',item.id)"></span>
                                <span class="icon del" @click="del('Note',item.id)"></span>
                            </td>
                            <td>{{index+1}}</td>
                            <td>{{item.name?item.name:item.ename}}</td>
                            <td>{{item.idcard?item.idcard:item.sib}}</td>
                            <td>{{item.note}}</td>
                        </tr>
                        </tbody>
                    </table>
                    <el-dialog :visible.sync="remarkPop" size="tiny">
                        <el-form :model="remarkForm" ref="remark" :rules="remarkRules">
                            <!-- <el-form-item label="备注人" label-width="120px" prop="name">
                                <el-col :span="20">
                                    <el-input v-model="remark.id" size="small" auto-complete="off" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="备注时间" label-width="120px" prop="time">
                                <el-col :span="20">
                                    <el-date-picker style="width:100%" v-model="remark.time" type="date" size="small" placeholder="请选择" auto-complete="off">
                                    </el-date-picker>
                                </el-col>
                            </el-form-item> -->
                            <el-form-item label="姓名" :label-width="width" prop="traineeid">
                                <el-col :span="20">
                                    <el-select style="width:100%" v-model="remarkForm.traineeid" placeholder="请选择"
                                               size="small" filterable>
                                        <el-option v-for="(item,index) in trainingStudent" :key="index"
                                                   :label="item.name?item.name:item.ename" :value="item.id"></el-option>
                                    </el-select>
                                </el-col>
                            </el-form-item>
                            <el-form-item label="备注" :label-width="width" prop="note">
                                <el-col :span="20">
                                    <el-input type="textarea" :rows="3" v-model="remarkForm.note" size="small"
                                              auto-complete="off" placeholder="请输入"></el-input>
                                </el-col>
                            </el-form-item>
                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="remarkPop = false">取 消</el-button>
                            <el-button type="primary" @click="add('remark','Note')">确 定</el-button>
                        </div>
                    </el-dialog>
                </el-tab-pane>
            </el-tabs>
        </div>
    </div>
</template>

<script>
    var timer;
    export default {
        data() {
            return {
                checkedTraineeArr: [],
                radio: 2,
                activeName1: "Trainee",
                activeName: "Hotel",
                activeName2: "ago",
                activeName3: "1",
                width: "140px",
                span: 18,
                input1: "",
                input2: "",

                studentPop: false,
                studentForm: {
                    traineeid: "",
                    trainingid: "",
                    idcard: ""
                },

                importFormVisible: false,
                fileList: [],
                action: PATH + "train/trainingTraineeImport",


                LatePop: false,
                late: {
                    id: "",
                    state: "",
                    latetime: ""
                },

                leavePop: false,
                leave: {
                    id: "",
                    reason: "",
                    state: "",
                    reject_reason: ""
                },

                markPop: false,
                mark: {
                    name: ""
                },
                markRules: {
                    name: [
                        {
                            type: "number",
                            required: true,
                            message: "请选择教师",
                            trigger: "change"
                        }
                    ]
                },

                backRules: {
                    name: [
                        {
                            type: "number",
                            required: true,
                            message: "请选择教师",
                            trigger: "change"
                        }
                    ]
                },

                backPop: false,
                back: {
                    name: ""
                },

                deitPop: false,
                deitForm: {
                    id: "",
                    payer: "",
                    apply:'',
                    chuandong:'',
                    daili:'',
                    zhiwu:'',
                    tuition: "",
                    paid: "",
                    inv: "",
                    tuition_note: "",
                },
                tuition_total: 0,
                paid_total: 0,
                integral_total: 0,

                bookingPop: false,
                bookingForm: {
                    traineeid: "",
                    trainingid: "",
                    idcard: "",
                    id: "",
                    date: "",
                    flight: ""
                },
                bookingRules: {
                    traineeid: [
                        {
                            type: "number",
                            required: true,
                            message: "请选择姓名",
                            trigger: "change"
                        }
                    ],
                    date: [
                        {
                            type: "date",
                            required: true,
                            message: "请选择日期",
                            trigger: "change"
                        }
                    ]
                },

                trafficPop: false,
                trafficForm: {
                    traineeid: "",
                    trainingid: "",
                    idcard: "",
                    id: "",
                    date: "",
                    flight: "",
                    train: "",
                    traffic: ""
                },
                trafficRules: {
                    traineeid: [
                        {
                            type: "number",
                            required: true,
                            message: "请选择姓名",
                            trigger: "change"
                        }
                    ],
                    date: [
                        {
                            type: "date",
                            required: true,
                            message: "请选择日期",
                            trigger: "change"
                        }
                    ]
                },

                hotelPop: false,
                hotelForm: {
                    hotel_payer: "",
                    trainingid: "",
                    idcard: "",
                    id: "",
                    hotel: "",
                    hotelid: "",
                    startdate: "",
                    enddate: "",
                    days: "",
                    hotel_money: "",
                    paid_money: "",
                    give_money: ""
                },
                hotel_money_total: 0,
                hotel_paid_money_total: 0,
                hotel_give_money_total: 0,


                foodPop: false,
                foodForm: {
                    meal_payer: "",
                    trainingid: "",
                    idcard: "",
                    id: "",
                    meal: "",
                    meal_money: "",
                    meal_paid_money: ""
                },
                meal_money_total: 0,
                meal_paid_money_total: 0,


                remarkPop: false,
                remarkForm: {
                    traineeid: "",
                    trainingid: "",
                    id: "",
                    note: ""
                },
                remarkRules: {
                    traineeid: [
                        {
                            type: "number",
                            required: true,
                            message: "请选择姓名",
                            trigger: "change"
                        }
                    ],
                    note: [
                        {
                            required: true,
                            message: "请输入备注内容",
                            trigger: "blur"
                        }
                    ]
                },
                prepare: {},

                scoreAogPop: false,
                scoreBackPop: false,
                radio1: "",
                radio2: 0,

                search: '',

                id: "",
                trainDetail: {},
                allStudent: [],
                trainingStudent: [],
                studentList: [],
                list: [],
                disabled1: true,
                disabled2: true,
                disabled3: true,
                disabled4: true,
                hotelList: {},
                payList: [],
                payer: '',
                qrcode: false,
                teacherList: [],
                Teachers: [],
                teacher: "",
                RaisalList: [],
                RaisalDetail: [],
                info: {},

                signin_planid: "",
                signin_traineeid: "",
                myChart1: {},
                myChart2: {},
                option: {
                    title: {
                        text: ""
                    },
                    // tooltip: {},
                    toolbox: {
                        show: true,
                        right: 20,
                        feature: {
                            saveAsImage: {
                                //保存图片
                                show: true
                            }
                        }
                    },
                    legend: {
                        data: []
                    },
                    radar: {
                        name: {
                            formatter: text => {
                                text = text.replace(/\S{10}/g, function (match) {
                                    return match + "\n";
                                });
                                return text;
                            },
                            textStyle: {
                                color: "#333"
                            }
                        },
                        indicator: []
                    },
                    series: [
                        {
                            name: "客户反馈",
                            type: "radar",
                            label: {
                                normal: {
                                    show: true,
                                    formatter: function (params) {
                                        return params.value;
                                    }
                                }
                            },
                            data: []
                        }
                    ]
                },
                apply_id: '',
                applylist: [],
                showLeftTable: false,
                showTopTable: false,
                scrollLeft: 0,
                scrollTop: 0,
                zhiwuList:[],
            };
        },

        created() {
            this.id = this.$route.params.id;
            this.getTrainDetail();
            this.getList("Trainee");
            // 获取所有学员
            // this.apiPost("System/traineeLists").then(res => {
            //   this.allStudent = res;
            // });
            this.getTeacher();
            this.getRaisalList();
            this.getTrainingStudent();
            // this.getpayersearch();
        },

        methods: {
            getZhiwuList() {
                this.apiPost("System/zhiwuLists").then(res => {
                    this.zhiwuList = res;
                });
            },
            getpayersearch() {
                this.apiPost("System/customerLists", {}).then(res => {
                    this.applylist = res;
                });
            },
            scroll(e) {
                let dom = document.getElementById('signin-table')
                this.showLeftTable = dom.scrollLeft > 0
                this.showTopTable = dom.scrollTop > 0
                document.getElementById('top-table').style.left = 146 - dom.scrollLeft + 'px'
                document.getElementById('left-table').style.top = 120 - dom.scrollTop + 'px'

                if (this.scrollTop != dom.scrollTop && dom.scrollLeft == this.scrollLeft && this.showTopTable) {
                    document.getElementById('top-table').style.zIndex = 1000
                    document.getElementById('left-table').style.zIndex = 999
                    this.scrollTop = dom.scrollTop
                }
                if (this.scrollLeft != dom.scrollLeft && dom.scrollTop == this.scrollTop && this.showLeftTable) {
                    document.getElementById('left-table').style.zIndex = 1000
                    document.getElementById('top-table').style.zIndex = 999
                    this.scrollLeft = dom.scrollLeft
                }
            },
            traineeSearch() {
                this.checkedTraineeArr = []
                this.apiPost("System/getTrainee", {search: this.search}).then(res => {
                    this.allStudent = res;
                });
            },
            checkedTrainee(id) {
                let index = this.checkedTraineeArr.indexOf(id)
                if (index == -1) {
                    this.checkedTraineeArr.push(id)
                } else {
                    this.checkedTraineeArr.splice(index, 1)
                }
            },
            checkedBox(e) {
                e.stopPropagation();
            },
            addTrainee() {
                this.studentPop = false
                if (this.checkedTraineeArr.length) {
                    let data = {
                        trainee: this.checkedTraineeArr,
                        trainingid: this.id
                    }
                    this.apiPost('Train/trainingTraineeAdd', data).then(res => {
                        _g.toastMsg(res.error ? 'error' : 'success', res.msg)
                        if (!res.error) {
                            this.getList('Trainee')
                            this.search = ''
                            this.allStudent = []
                            this.checkedTraineeArr = []
                        } else {
                            this.studentPop = true
                        }
                    })
                } else {
                    _g.toastMsg('warning', '请选择要添加的学员')
                }
            },
            getTrainingStudent() {
                let data = {
                    id: this.id
                };
                this.apiPost("System/trainingStudent", data).then(res => {
                    this.trainingStudent = res;
                });
            },
            formChange(tab) {
                if (!tab.name) {
                    return;
                } else if (tab.name == "Hotel") {
                    if (this.activeName == "Hotel") {
                        this.getList("Hotel");
                        return;
                    } else if (this.activeName == "Meal") {
                        this.getList("Meal");
                        return;
                    }
                } else if (tab.name == "Appraisal") {
                } else if (tab.name == "Feedback") {
                    this.getFeedback();
                    return;
                }
                this.getList(tab.name);
            },

            formChange2(tab) {
                this.activeName2 = tab.name;
                this.getRaisalList();
            },
            // 获取培训计划详情
            getTrainDetail() {
                let data = {
                    id: this.id
                };
                this.apiPost("Train/trainingDetail", data).then(res => {
                    this.trainDetail = res;
                });
            },
            // 获取列表
            getList(name) {
                let data = {
                    id: this.id
                };
                if (name == 'Pay') {
                    data['apply_id'] = this.apply_id;
                }
                if (name == "Prepare") {
                    this.apiPost("Train/trainingPrepare", data).then(res => {
                        this.prepare = res;
                        this.input1 = res.haocai;
                        this.input3 = res.haocainum;
                    });
                    return;
                }
                this.apiPost("Train/training" + name, data).then(res => {
                    this.list = res;
                    if (name == "Trainee") {
                        this.studentList = res;
                        this.btnDisabled();
                    }
                    if (name == "Certificate") {
                        for (var i = 0; i < this.list.length; i++) {
                            if (!this.list[i].certificate_provide) {
                                this.disabled4 = false;
                                break;
                            } else {
                                this.disabled4 = true;
                            }
                        }
                    }
                    if (name == "Pay") {
                        this.tuition_total = 0;
                        this.paid_total = 0;
                        this.integral_total = 0;
                        res.forEach(item => {
                            this.tuition_total += parseFloat(item.tuition) || 0;
                            this.paid_total += parseFloat(item.paid) || 0;
                            this.integral_total += parseInt(item.integral) || 0;
                        })
                        this.tuition_total = this.tuition_total.toFixed(2)
                        this.paid_total = this.paid_total.toFixed(2)
                    }
                    if (name == "Hotel") {
                        this.hotel_money_total = 0;
                        this.hotel_paid_money_total = 0;
                        this.hotel_give_money_total = 0;
                        res.forEach(item => {
                            this.hotel_money_total += parseFloat(item.hotel_money) || 0;
                            this.hotel_paid_money_total += parseFloat(item.paid_money) || 0;
                            this.hotel_give_money_total += parseFloat(item.give_money) || 0;
                        })
                        this.hotel_money_total = this.hotel_money_total.toFixed(2)
                        this.hotel_paid_money_total = this.hotel_paid_money_total.toFixed(2)
                        this.hotel_give_money_total = this.hotel_give_money_total.toFixed(2)
                    }
                    if (name == "Meal") {
                        this.meal_money_total = 0;
                        this.meal_paid_money_total = 0;
                        res.forEach(item => {
                            this.meal_money_total += parseFloat(item.meal_money) || 0;
                            this.meal_paid_money_total += parseFloat(item.meal_paid_money) || 0;
                        })
                        this.meal_money_total = this.meal_money_total.toFixed(2)
                        this.meal_paid_money_total = this.meal_paid_money_total.toFixed(2)
                    }
                });
                if (name == "Hotel") {
                    this.apiPost("System/hotelLists").then(res => {
                        this.hotelList = res;
                    });
                }
            },

            getPayerList(id) {
                this.apiPost("System/payerLists", {id: id}).then(res => {
                    this.payList = res;
                });
            },

            // 过滤外籍学员
            fillCountry() {
                if (this.radio == 1) {
                    this.studentList = this.list.filter(cur => {
                        return (cur.country && cur.country != "中国");
                    });
                } else {
                    this.studentList = this.list;
                }
            },
            // 选择姓名自动填充身份证号
            getIdcard(name) {
                this.allStudent.forEach(ele => {
                    if (this[name + "Form"].traineeid == ele.id) {
                        this[name + "Form"].idcard = ele.idcard ? ele.idcard : ele.sib;
                    }
                });
            },
            // 添加
            add(name, type) {
                this.$refs[name].validate(valid => {
                    if (valid) {
                        this[name + "Pop"] = false;
                        let data = this[name + "Form"];
                        delete data.idcard;
                        data.trainingid = this.id;
                        this.apiPost(
                            "Train/training" + type + (name == "student" ? "Add" : "Edit"),
                            data
                        ).then(res => {
                            if (res.error) {
                                this.$message.error(res.msg);
                            } else {
                                this.$message({
                                    message: res.msg,
                                    type: "success"
                                });
                                this.getList(type);
                            }
                        });
                    } else {
                        return false;
                    }
                });
            },
            // 删除
            del(name, id) {
                this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                })
                    .then(() => {
                        let data = {
                            id: id
                        };
                        this.apiPost("Train/training" + name + "Delete", data).then(res => {
                            if (res.error) {
                                this.$message.error(res.msg);
                            } else {
                                this.$message({
                                    message: res.msg,
                                    type: "success"
                                });
                                this.getList(name);
                            }
                        });
                    })
                    .catch(() => {
                    });
            },
            // 确认，参加，完成 点击事件
            btnClick(name, btn, stuId) {
                let data = {
                    id: stuId ? stuId : "",
                    trainingid: this.id
                };
                let url = "";
                switch (btn) {
                    // 确认
                    case 1:
                        url = "Train/training" + name + "Confirm";
                        break;
                    // 参加
                    case 2:
                        url = "Train/trainingTraineeParticipate";
                        break;
                    // 完成
                    case 3:
                        url = "Train/trainingTraineeFinish";
                        break;
                }
                this.apiPost(url, data).then(res => {
                    if (res.error) {
                        this.$message.error(res.msg);
                    } else {
                        this.$message({
                            message: res.msg,
                            type: "success"
                        });
                        this.getList(name);
                    }
                });
            },
            // 控制全部确认，全部参加，全部完成按钮的禁用
            btnDisabled() {
                this.list.forEach(ele => {
                    if (!ele.isconfirm) {
                        this.disabled1 = false;
                    } else {
                        this.disabled1 = true;
                    }
                    if (!ele.isparticipate) {
                        this.disabled2 = false;
                    } else {
                        this.disabled2 = true;
                    }
                    if (!ele.isfinish) {
                        this.disabled3 = false;
                    } else {
                        this.disabled3 = true;
                    }
                });
            },
            getInfo(name, type, id, tid) {
                if (type && id) {
                    this[name + "Form"].id = id;
                    let data = {
                        id: id
                    };
                    this.apiPost("Train/training" + type + "Detail", data).then(res => {
                        this[name + "Pop"] = true;
                        setTimeout(() => {
                            this.$refs[name].resetFields();
                            this[name + "Form"] = res;
                        }, 0);
                    });
                    if (type == 'Pay' || type == 'Hotel' || type == 'Meal') {
                        this.getPayerList(tid)
                    }
                } else {
                    this[name + "Pop"] = true;

                    if (name != "student") {
                        this[name + "Form"].id = "";
                        setTimeout(() => {
                            this.$refs[name].resetFields();
                        }, 0);
                    }
                }
            },
            addTeacher(name) {
                this.apiPost("System/getStaffLists").then(res => {
                    this[name + "Pop"] = true;
                    setTimeout(() => {
                        this.$refs[name].resetFields();
                    }, 0);
                    this.teacherList = res;
                });
            },

            subAddTeacher(name) {
                this.$refs[name].validate(valid => {
                    if (valid) {
                        this[name + "Pop"] = false;
                        let data = {
                            staff_id: this[name].name,
                            training_id: this.id,
                        };
                        this.apiPost("Train/addAppraisalTeacher", data).then(res => {
                            if (res.error) {
                                this.$message.error(res.msg);
                            } else {
                                this.$message({
                                    message: res.msg,
                                    type: "success"
                                });
                                this.getTeacher();
                            }
                        });
                    } else {
                        return false;
                    }
                });
            },

            getTeacher() {
                let data = {
                    training_id: this.id
                }
                this.apiPost("System/getAppraisalTeacher", data).then(res => {
                    this.Teachers = [];
                    res.forEach(item => {
                        this.Teachers.push(item.name);
                    });
                    this.teacher = this.Teachers.unique().toString();
                });
            },

            getRaisalList() {
                if (this.activeName2 === "ago") {
                    let data = {
                        id: this.id,
                        type: 1
                    };
                    this.apiPost("Train/appraisalList", data).then(res => {
                        this.RaisalList = res;
                    });
                } else {
                    let data = {
                        id: this.id,
                        type: 2
                    };
                    this.apiPost("Train/appraisalList", data).then(res => {
                        this.RaisalList = res;
                    });
                }
            },

            getRaisalDetail(id, name) {
                let data = {id: id};
                this.apiPost("Train/appraisalDetail", data).then(res => {
                    this[name + "Pop"] = true;
                    this.info = res.info;
                    this.RaisalDetail = res.list;
                });
            },

            scoreSubmit(name, pid) {
                let arr = [];
                for (let i = 0; i < this.RaisalDetail.length; i++) {
                    if (this.RaisalDetail[i].type == 3) {
                        if (this.RaisalDetail[i].his_score > this.RaisalDetail[i].score) {
                            _g.toastMsg('warning', '问答题得分不能超过满分')
                            return false
                        }
                        let obj = {};
                        obj.id = this.RaisalDetail[i].id;
                        obj.score = this.RaisalDetail[i].his_score;
                        arr.push(obj);
                    }
                }
                let data = {
                    pid: pid,
                    question: arr
                };
                this.apiPost("Train/submitAppraisal", data).then(res => {
                    this[name + "Pop"] = false;
                    let remind = res.error ? "error" : "success";
                    _g.toastMsg(remind, res.msg);
                    this.getRaisalList()
                });
            },

            certificateGrant(btn, id) {
                let data = {
                    id: id ? id : "",
                    trainingid: this.id
                };
                let url =
                    "Train/training" +
                    (btn === 1 ? "CertificateGrant" : "CertificatePrint");
                this.apiPost(url, data).then(res => {
                    if (btn === 1) {
                        if (res.error) {
                            this.$message.error(res.msg);
                        } else {
                            this.$message({
                                message: res.msg,
                                type: "success"
                            });
                        }
                    } else {
                        if (res.error) {
                            this.$message.error(res.msg);
                        } else {
                            if (res.url) {
                                window.location.href = res.url;
                            } else {
                                this.$message.error('打印错误');
                            }

                        }
                    }
                    this.getList("Certificate");
                });
            },

            signin(id) {
                this.qrcode = true;
                this.qrcodeMake(id);
                timer = setInterval(() => {
                    this.qrcodeMake(id);
                }, 10000);
            },

            qrcodeMake(id) {
                let rand = _g.randomString();
                let data = {
                    id: id,
                    rand: rand
                };
                this.apiPost("Train/trainingSigninStart", data).then(res => {
                    if (res.error) {
                        //this.qrcodeMake(id)
                    } else {
                        var canvas = document.getElementById("canvas");
                        let str = id + "&" + rand;
                        QRCode.toCanvas(canvas, str, function (error) {
                            if (error) {
                            }
                        });
                    }
                });
            },

            signinEnd() {
                clearInterval(timer);
                this.getList("Signin");
            },

            signinDetail(id, index, value) {
                this.signin_planid = id;
                this.signin_traineeid = this.list.trainee[index].traineeid;
                if (value == "请假(待审核)") {
                    let data = {
                        planid: id,
                        traineeid: this.list.trainee[index].traineeid
                    };
                    this.apiPost("Train/trainingLeave", data).then(res => {
                        this.leavePop = true;
                        this.leave.reason = res.reason;
                        this.leave.state = res.state ? res.state : "";
                        this.leave.reject_reason = res.reject_reason;
                        this.leave.id = res.id;
                    });
                }
                if (value == "旷到") {
                    let data = {
                        planid: id,
                        traineeid: this.list.trainee[index].traineeid
                    };
                    this.apiPost("Train/trainingLate", data).then(res => {
                        this.LatePop = true;
                        this.late.state = res.state;
                        this.late.id = res.id;
                        this.late.latetime = res.latetime;
                    });
                }
            },
            leaveSubmit() {
                let data = this.leave;
                this.apiPost("Train/trainingLeaveSub", data).then(res => {
                    let remind = res.error ? "error" : "success";
                    _g.toastMsg(remind, res.msg);
                    if (!res.error) {
                        this.leavePop = false;
                        this.getList("Signin");
                    }
                });
            },
            stateSubmit() {
                let data = this.late;
                this.apiPost("Train/trainingLateSub", data).then(res => {
                    let remind = res.error ? "error" : "success";
                    _g.toastMsg(remind, res.msg);
                    if (!res.error) {
                        this.LatePop = false;
                        this.getList("Signin");
                    }
                });
            },
            confirm(name) {
                let data = {
                    trainingid: this.id,
                    name: name
                };

                if (name == "haocai") {
                    data.value = this.input1;
                }
                if (name == "haocainum") {
                    data.value = this.input2;
                }
                this.apiPost("Train/trainingPrepareConfirm", data).then(res => {
                    let remind = res.error ? "error" : "success";
                    _g.toastMsg(remind, res.msg);
                    if (!res.error) {
                        this.getList("Prepare");
                    }
                });
            },
            drawChart() {
                this.myChart1 = this.$echarts.init(document.querySelector("#myChart1"));
                this.myChart1.setOption(this.option);
                this.myChart2 = this.$echarts.init(document.querySelector("#myChart2"));
                this.myChart2.setOption(this.option);
            },
            getFeedback() {
                this["myChart" + this.activeName3].showLoading("default", {
                    color: "#0177BF"
                });
                let data = {
                    id: this.id,
                    type: this.activeName3
                };
                this.apiPost("Train/trainingFeedback", data).then(res => {
                    this["myChart" + this.activeName3].hideLoading();
                    this["myChart" + this.activeName3].setOption({
                        radar: {
                            indicator: res.indocator
                        },
                        series: [
                            {
                                data: res.data
                            }
                        ]
                    });
                });
            },
            handleClick() {
                this.getFeedback();
            },

            /**
             * 下载学员名单
             */
            download() {
                let data = {
                    id: this.id
                };
                this.apiPost("System/trainingStudent", data).then(res => {
                    require.ensure([], () => {
                        const {export_json_to_excel} = require('@/vendor/Export2Excel')
                        const tHeader = ['姓名', '姓名（英文）', '职务', '身份证号', 'SIB', '船东', '代理公司', '缴费备注']
                        const filterVal = ['name', 'ename', 'zhiwu', 'idcard', 'sib', 'chuandong', 'daili', 'tuition_note']
                        const data = this.formatJson(filterVal, res)
                        export_json_to_excel(tHeader, data, this.trainDetail.name + this.trainDetail.startdate + '培训学员名单')
                    })
                });
            },
            formatJson(filterVal, jsonData) {
                return jsonData.map(v => filterVal.map(j => v[j]));
            },

            upload() {
                this.importFormVisible = true
                this.fileList = [];
            },
            importStudentSubmit() {
                this.$refs.upload.submit();
            },
            uploadSuccess(res) {
                let remind = res.error ? "error" : "success";
                _g.toastMsg(remind, res.msg);
                if (!res.error) {
                    this.getList("Trainee");
                    this.getTrainingStudent();
                    this.importFormVisible = false;
                }
                if (res.url) {
                    window.location.href = res.url
                }
            },

            /**
             * 下载签到信息
             */
            downloadSignin() {
                let data = {
                    id: this.id
                }
                this.apiPost('system/downloadSignin', data).then(res => {
                    if (res) {
                        window.location.href = res
                    }
                })
            },
            /**
             * 下载缴费信息
             */
            downloadPay() {
                let data = {
                    id: this.id
                }
                this.apiPost('system/downloadPay', data).then(res => {
                    if (res) {
                        window.location.href = res
                    }
                })
            },

            /**
             * 学员名单，点击身份证号跳转学员详情页
             */
            traineeDetail(id) {
                router.push('/trainee/detail/' + id)
            },

            /**
             * 酒店离店日期改变后自动生成酒店入住天数
             */
            hotelEndDateChange(value) {
                let start_date = new Date(this.hotelForm.startdate)
                let end_date = new Date(this.hotelForm.enddate)
                if (start_date && end_date && end_date > start_date) {
                    let days = (end_date - start_date) / 1000 / 3600 / 24
                    this.$set(this.hotelForm, 'days', days)
                    this.hotelDaysChange()
                }
            },

            /**
             * 酒店入住天数改变后自动生成酒店费用
             */
            hotelDaysChange() {
                if (this.hotelForm.hotel && this.hotelForm.days) {
                    this.hotelForm.hotel_money = this.hotelForm.hotel * this.hotelForm.days
                }
            },

            /**
             * 酒店费用下载
             */
            downloadHotel() {
                let data = {
                    id: this.id
                };
                this.apiPost("train/trainingHotel", data).then(res => {

                    res.forEach((item, index) => {
                        item.index = index + 1;
                        item.name = item.name || item.ename;
                        item.idcard = item.idcard || item.sib
                    })
                    let total = {
                        index: '合计',
                        hotel_money: this.hotel_money_total,
                        paid_money: this.hotel_paid_money_total,
                        give_money: this.hotel_give_money_total,
                    }
                    res.push(total)
                    require.ensure([], () => {
                        const {export_json_to_excel} = require('@/vendor/Export2Excel')
                        const tHeader = ['序号', '姓名', '身份证号/SIB', '联系电话', '酒店名称', '酒店标准', '入住日期', '离店日期', '入住天数', '住宿总费用',
                            '已收费用', '付费方', '已付费用']
                        const filterVal = ['index', 'name', 'idcard', 'tel', 'hotel_name', 'hotel', 'startdate', 'enddate', 'days', 'hotel_money',
                            'paid_money', 'payer', 'give_money']
                        const data = this.formatJson(filterVal, res)
                        export_json_to_excel(tHeader, data, this.trainDetail.name + this.trainDetail.startdate + '学员酒店名单')
                    })
                });
            },

            /**
             * 伙补费用下载
             */
            downloadMeal() {
                let data = {
                    id: this.id
                };
                this.apiPost("train/trainingMeal", data).then(res => {
                    res.forEach((item, index) => {
                        item.index = index + 1;
                        item.name = item.name || item.ename;
                        item.idcard = item.idcard || item.sib
                    })
                    let total = {
                        index: '合计',
                        meal_money: this.meal_money_total,
                        meal_paid_money: this.meal_paid_money_total,
                    }
                    res.push(total)
                    require.ensure([], () => {
                        const {export_json_to_excel} = require('@/vendor/Export2Excel')
                        const tHeader = ['序号', '姓名', '身份证号/SIB', '联系电话', '伙补标准', '伙补总费用', '已缴费用', '付费方']
                        const filterVal = ['index', 'name', 'idcard', 'tel', 'meal', 'meal_money', 'meal_paid_money', 'payer']
                        const data = this.formatJson(filterVal, res)
                        export_json_to_excel(tHeader, data, this.trainDetail.name + this.trainDetail.startdate + '学员伙补名单')
                    })
                });
            },

            delAppraisal(id) {
                this.$confirm('确认删除?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    let data = {
                        id: id
                    }
                    this.apiPost('train/delAppraisal', data).then(res => {
                        _g.toastMsg(res.error ? 'error' : 'success', res.msg)
                        if (!res.error) {
                            this.getRaisalList()
                        }
                    })
                }).catch(() => {
                });

            }
        },
        mounted() {
            this.drawChart();
            this.getZhiwuList();
        }
    };
</script>

<style scoped>
    .red {
        color: #ff0000;
    }

    .head {
        padding-left: 20px;
        height: 50px;
        line-height: 50px;
    }

    .head span {
        vertical-align: middle;
        height: 16px;
        font-size: 14px;
        font-family: MicrosoftYaHei;
        color: rgba(102, 102, 102, 1);
        line-height: 16px;
    }

    .head button {
        margin-left: 50px;
    }

    .head .em {
        color: rgba(255, 0, 0, 1);
    }

    .table {
        border-collapse: collapse;
        table-layout: fixed;
        text-align: center;
        color: #666666;
    }

    .table,
    .table tr th,
    .table tr td {
        border: 1px solid #e2e2e2;
    }

    .table thead {
        background: rgba(239, 245, 249, 1);
        font-size: 14px;
    }

    .table tbody {
        font-size: 12px;
    }

    .table tr {
        height: 60px;
    }

    .addb {
        background: url(../../img/add.gif) no-repeat;
    }

    .deit {
        background: url(../../img/edit.gif) no-repeat;
    }

    .miss {
        color: #ff0000;
    }

    .late {
        color: rgba(255, 127, 0, 1);
    }

    .leave {
        color: rgba(1, 191, 50, 1);
    }

    .trHead > th {
        background-color: #fff;
    }

    .scoreDetail h4 {
        text-align: center;
        font-size: 20px;
    }

    .scoreDetail .el-row {
        text-align: center;
        margin-top: 20px;
    }

    .scoreDetail .questions {
        margin-top: 30px;
    }

    .el-radio-group > div {
        padding: 10px 10px 0;
    }

    .answer {
        padding: 20px 10px;
    }

    .answer > span {
        margin-right: 50px;
    }

    .teacher {
        margin-left: 30px;
    }

    #canvas {
        width: 300px !important;
        height: 300px !important;
        margin: 0 auto;
    }

    .info {
        margin: 10px 10px 0;
    }

    .signin-tab {
        /* overflow: auto; */
    }

    .signin-table {
        /* width: 100%; */
        /* table-layout: auto; */
    }

    .signin-table th, .signin-table td {
        min-width: 70px;
        box-sizing: content-box;
    }

    .text-warining {
        color: #ffaa5d;
    }

    .table-wrapper {
        width: 100%;
        height: 450px;
        overflow-y: auto;
    }

    .right-table {
        width: calc(100% - 120px);
        overflow: auto;
    }

    .detail-table, .detail-table tr td {
        border: 0;
        border-right: 1px solid #e2e2e2;
        border-bottom: 1px solid #e2e2e2;
    }

    .head-table tr td, .head-table tr th {
        border: 0;
        border-right: 1px solid #e2e2e2;
        border-bottom: 1px solid #e2e2e2;
    }

    .head-table tr th {
        border-top: 1px solid #e2e2e2;
    }

    .top-table {
        position: absolute;
        top: 50px;
        left: 146px;
        z-index: 999;

        height: 120px;
        overflow: hidden;
        background: #fff;
        border-bottom: 1px solid #e2e2e2;
    }

    .top-table table {
        /* width: 100%; */
    }

    .left-table {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 999;

        overflow: hidden;
        background: #fff;
    }

    .left-table table {
        height: 313px;
        overflow: hidden;
    }

    .common-table {
        position: absolute;
        top: 50px;
        left: 0;
        z-index: 999;
        background: #fff;
    }

    .top-table th, .top-table td {
        border: 0;
    }
</style>
